import os

import fasttext

from __00__config import Config

def train_model():
	# 使用fasttext训练模型
	model = fasttext.train_supervised(
		input=config.processed_word_train_datapath,
		dim=100,
		minn=2,
		maxn=6
	)
	# 评估模型
	print(model.test(config.processed_word_test_datapath))

	# 保存模型
	model_path = os.path.join(config.ft_model_save_path, 'model_word_default.bin')
	model.save_model(model_path)


if __name__ == '__main__':
	config = Config()
	train_model()
